package com.dulichdanang.location.location;

import java.util.List;
import java.util.Locale;

import lib.map.GoogleMapOverlay;
import lib.map.MyGoogleMapAPI;
import lib.map.MyMedia;

import com.dulichdanang.R;
import com.dulichdanang.R.layout;
import com.dulichdanang.R.menu;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Point;
import android.location.Geocoder;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;

public class LocationMapActivity extends MapActivity {

	MapView mapView;
	GeoPoint p;
    MapController mc;
    Geocoder geoCoder;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_location_map);
		mapView = (MapView)findViewById(R.id.myMap);
		 //Add zoom view to Google Maps
	    mapView = (MapView)findViewById(R.id.myMap);
	    LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);
	    View zoomView = mapView.getZoomControls();
	    zoomLayout.addView(zoomView, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
	    mapView.displayZoomControls(true);
        geoCoder = new  Geocoder(this,Locale.getDefault());
        // Tạo đối tượng Location, đối tượng lấy từ id ở activity Locations
       
        
        //GeoPoint p =MyGoogleMapAPI.getGeoPoint(MyGoogleMapAPI.getLocationInfo(name.replace("\n"," ").replace(" ", "%20")));
 	    p = MyGoogleMapAPI.getGeoPoint("16.063527,108.205479");
        mc = mapView.getController();
        mc.animateTo(p);
        mc.setZoom(17);
        GoogleMapOverlay mapOverlay = new GoogleMapOverlay(p,this,R.drawable.pink);
        List<Overlay> listOfOverlays = mapView.getOverlays();
        listOfOverlays.clear();
        listOfOverlays.add(mapOverlay); 
        mapView.invalidate();	
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_location_map, menu);
		return true;
	}

	@Override
	protected boolean isRouteDisplayed() {
		// TODO Auto-generated method stub
		return false;
	}

}
